// type命令用来定义一个类型的别名

type Age = number;
let age: Age = 55;

type ParamsType = string | number | string[]
const fun = (params: ParamsType) => {
    if (typeof params === "string") {
        console.log(params.length)
    } else if (typeof params === "number") {
        console.log(params.toFixed(2))
    } else {
        params.forEach(item => {
            console.log(item)
        })
    }
}

fun(10)

